package com.xuan.judge.rabbit;

import com.xuan.api.domain.dto.JudgeSubmitDTO;
import com.xuan.common.core.constants.RabbitmqConstants;
import com.xuan.judge.service.JudgeService;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class JudgeConsumer {


    @Resource
    private JudgeService judgeService;

    @RabbitListener(queues = RabbitmqConstants.OJ_WORK_QUEUE)
    public void consumeMessage(JudgeSubmitDTO judgeSubmitDTO) {
        log.info("JudgeConsumer 收到消息:{}", judgeService);
        judgeService.doJudgeJavaCode(judgeSubmitDTO);
    }

}
